package com.panshi.service.impl;

import com.panshi.entity.AppAnswerT;
import com.panshi.entity.SysAnswerCheckT;
import com.panshi.service.AnswerClientService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class AnswerClientServiceFallbackFactory implements FallbackFactory<AnswerClientService> {

    @Override
    public AnswerClientService create(Throwable cause) {
        System.out.println("服务降级 answer --------------》");
        return new AnswerClientService() {
            @Override
            public List<AppAnswerT> all() {
                return new ArrayList<>();
            }

            @Override
            public AppAnswerT bymid(Integer id) {
                return new AppAnswerT();
            }

            @Override
            public Boolean answerAdd(SysAnswerCheckT sysAnswerCheckT) {
                return false;
            }
        };
    }
}
